﻿using XKJ.OAWeb.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XKJ.OAWeb.EFCore
{
    public class MyDbContext : DbContext
    {
        public MyDbContext(DbContextOptions options) : base(options)
        {
        }
        //播种
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<User>().HasData(new User
            {
                UId=1,
                UserName="admin",
                UserPassword="admin"
            });
        }

        public DbSet<Role> Role { get; set; }
        public DbSet<User> User { get; set; }
        public DbSet<Navigation> Navigation { get; set; }
        public DbSet<Limits> Limits { get; set; }
        public DbSet<UserRole> UserRole { get; set; }
        public DbSet<RoleLimits> RoleLimits { get; set; }
    }
}
